package com.example.dao;

import com.example.pojo.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户 持久层接口
 *
 * @author Chengfei
 * @date 2020/8/22 8:18
 */
@Mapper
@Repository
public interface UserDao {

    //查询所有
    @Select("select * from user")
    public List<User> findAll();

    //新增
    @Insert("insert into user (username,password,name) values(#{username},#{password},#{name}) ")
    public void insert(User user);

    //修改
    @Update("update user set username=#{username},password=#{password},name=#{name} where id=#{id} ")
    public void update(User user);

    //删除
    @Delete("delete from user where id=#{id} ")
    public void delete(Integer id);

}
